//
//  NSString+Random.m
//  ShenWeiRent
//
//  Created by iMac on 2019/3/15.
//  Copyright © 2019年 liyefu. All rights reserved.
//

#import "NSString+Random.h"

@implementation NSString (Random)

+ (NSString *)randomString16
{
    static int length = 16;
    NSString *sourceStr = @"1234567890abcdefghijklmnopqrstuvwxyz";
    NSMutableString *string = @"".mutableCopy;
//    srand((unsigned)time(0));
    for (int i = 0; i < length; i++) {
        unsigned index = arc4random() % [sourceStr length];
        NSString *str = [sourceStr substringWithRange:NSMakeRange(index, 1)];
        [string appendString:str];
    }
    NSLog(@"<<<<<%@",string);
    return string;
}

@end
